package com.graducationdesign.springboot.controller.Admin;

import com.graducationdesign.springboot.entities.Administrator.GraducationDesignListMoudle.AttachmentInformation;
import com.graducationdesign.springboot.mapper.AttachmentInformationMapper;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;
import java.util.Map;

/**
 * @author Mr.zhneg
 * @create 2019-11-24-10:39
 */
@Controller
public class AttachmentInformationController {

//    这LoggerFactory是一个实用程序类，用于为各种日志记录API生成Logger，尤其是对于log4j，logback和JDK 1.4日志记录

//org.slf4j.Logger接口是SLF4J API的主要用户入口点。期望通过该接口的具体实现进行日志记录。
    org.slf4j.Logger logger=  LoggerFactory.getLogger(getClass());

    @Autowired
    AttachmentInformationMapper attachmentInformationMapper;


    //查看附件信息管理界面，并且可以查询附件信息管名字
    @GetMapping("/attachmentInformation")
    public String list(Map<String,Object> map, AttachmentInformation attachmentInformation){

        logger.info("附件信息查询"+attachmentInformation);
        List<AttachmentInformation> attachmentInformations=attachmentInformationMapper.getAttachmentInformation(attachmentInformation);
        logger.info("查询操作：附件信息查询结果。。。"+attachmentInformations);

        map.put("attachmentInformation",attachmentInformations);
        map.put("attachmentInformationName",attachmentInformation.getName());


        return "Administrator/graduationDesignInformationMoudle/AttachmentInformationManagement";
    }

    //删除附件信息
    @DeleteMapping("/attachmentInformation/{id}")
    public String delete(@PathVariable("id") Integer id){

        logger.info("删除操作：删除编号为"+id+"的附件信息管理");
        attachmentInformationMapper.deleteStudentById(id);
        return "Administrator/graduationDesignInformationMoudle/AttachmentInformationManagement";

    }


}
